function H=Hgeneration(num)

n=num;
j=4;
k=8;
q=n/j;
a=2;
b=7;

for r=1:4
    for c=1:4
        H(q*(r-1)+1:q*r,q*(c-1)+1:q*c)=circshift(eye(q),[a^(r-1)*b^(c-1),0]);
    end
end
H(1:q,n+1:n+q)=eye(q);
H(1:q,n+q+1:n+2*q)=eye(q);
H(1:q,n+2*q+1:n+3*q)=zeros(q);
H(1:q,n+3*q+1:n+4*q)=zeros(q);

H(q+1:2*q,n+1:n+q)=zeros(q);
H(q+1:2*q,n+q+1:n+2*q)=eye(q);
H(q+1:2*q,n+2*q+1:n+3*q)=eye(q);
H(q+1:2*q,n+3*q+1:n+4*q)=zeros(q);

H(2*q+1:3*q,n+1:n+q)=eye(q);
H(2*q+1:3*q,n+q+1:n+2*q)=zeros(q);
H(2*q+1:3*q,n+2*q+1:n+3*q)=eye(q);
H(2*q+1:3*q,n+3*q+1:n+4*q)=eye(q);

H(3*q+1:4*q,n+1:n+q)=eye(q);
H(3*q+1:4*q,n+q+1:n+2*q)=zeros(q);
H(3*q+1:4*q,n+2*q+1:n+3*q)=zeros(q);
H(3*q+1:4*q,n+3*q+1:n+4*q)=eye(q);


